<template>
    <div>
        <breadcrumb :routerList="routerList"></breadcrumb>
        <selectBtn @btn="selectBtn"></selectBtn>
        <memberTable :memberList="memberList" @refreshTableFun="refreshTableFun"></memberTable>
        <pagination :total="total" @currentChange="currentChange"></pagination>
    </div>
</template>

<script>
    import breadcrumb from '@/components/breadcrumb.vue'
    import memberTable from '@/components/memberAre/memberTable.vue'
    import selectBtn from '@/components/memberAre/selectBtn.vue'
    import pagination from '@/components/paginationAre.vue'
    export default {
        name: "memberList",
        components:{breadcrumb,memberTable,selectBtn,pagination},
        data(){
            return {
                routerList:[
                    {
                        name:'会员管理',
                        path:''
                    },
                    {
                        name:'会员列表',
                        path:''
                    }
                ],
                memberList:[
                    {
                        id:1,
                        user_id:1,
                        shop_name:'222',
                        status:'2',
                        phone:'123'
                    }
                ],
                page:1,
                status:10,
                total:0
            }
        },
        created(){
            this.getMemberList();
        },
        methods:{
            selectBtn(status){
                console.log(status);
                this.status = status
                this.getMemberList();
            },
            async getMemberList(){
                let res = await this.$Http.getMember(
                    {
                        p:this.page,
                        num:this.$store.state.pageNum,
                        status:this.status
                    }
                )
                console.log(res);
                this.memberList = res.list;
                this.total = Number(res.count)
            },
            currentChange(value){
                this.page = value;
                this.getMemberList()
            },
            refreshTableFun(){
                this.getMemberList()
            }
        }
    }
</script>

<style scoped>

</style>
